import request from '@/utils/request'

export function getTotalBookList(page, size) {
  return request({
    url: 'book/table/' + page + '/' + size  ,
    method: 'get'
  })
}

export function deleteBook(data) {
  return request({
    url: 'book/delete' ,
    method: 'POST',
    data:data
  })
}
export function setBookCount(data) {
  return request({
    url: 'book/count',
    method: 'POST',
    data:data
  })
}


export function getBookDetailByIsbn(isbn) {
  return request({
    url: 'book/detail',
    method: 'POST',
    data:{ 'isbn': isbn }
  })
}



export function updateBookDetail(data) {
  return request({
    url: 'book/update' ,
    method: 'POST',
    data:data
  })
}


export function getCategoryList() {
  return request({
    url: 'category/list' ,
    method: 'get',
  })
}
export function deleteRecord(data) {
  return request({
    url: 'record/delete',
    method: 'POST',
    data
  })
}

export function getBookTotal() {
  return request({
    url: 'book/total',
    method: 'get',
  })
}

export function getBookBorrowHistory(page, size) {
  return request({
    url: 'record/table/' + page + '/' + size ,
    method: 'get',
  })
}
export function getRecordTotal(page, size) {
  return request({
    url: 'record/total/',
    method: 'get',
  })
}

export function getUserRecord(page, size,uid) {
  return request({
    url: 'record/list/' + page + '/' + size +'/' + uid,
    method: 'get',
  })
}

export function getUserRecordTotal(uid) {
  return request({
    url: 'record/count/' + uid,
    method: 'get',
  })
}
export function returnBook(data) {
  return request({
    url: 'record/return',
    method: 'post',
    data
  })
}

